/*******************************************************************************
Coder.h

	Author:		LiuDingXi
	e-mail:		liudx@gmail.com
	Date time:	2009-08-17

	Copyright (C) 2009
	All rights reserved.
	
*******************************************************************************/

#ifndef _CODER_H_
#define _CODER_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

typedef int SINT;

class CCoder
{
public:
	CCoder();
	virtual ~CCoder();

public:

	BOOL	SetFolder(LPCTSTR szFolder);

public:

	BOOL	Load(LPCTSTR szFileName);
	BOOL	Save(LPCTSTR szFileName);

	enum {LN_AFTER, LN_BEFORE, LN_BOUND};
	
	SINT	LnInsert(LPCTSTR szFlag, LPCTSTR szString, INT nFlag = LN_AFTER);
	SINT	LnRemove(LPCTSTR szFlag, LPCTSTR szString, INT nFlag = LN_BOUND);
	SINT	LnSearch(LPCTSTR szFlag, LPCTSTR szString, INT nFlag = LN_AFTER);

	BOOL	Replace(LPCTSTR szSrc, LPCTSTR szTar);

public:
	BOOL	TemplateOf(LPCTSTR szTplFile, LPCTSTR szTarFile, LPCTSTR szOld, LPCTSTR szNew);
	BOOL	TemplateFor(LPCTSTR szOldFile, LPCTSTR szOld, LPCTSTR szNew, LPCTSTR szNewFile);
	
	BOOL	HasSrcFile(LPCTSTR szFileName);

	CString	m_szSrcFolder;
	CString	m_szTplFolder;

protected:
	CStringList	m_list;

	
};


#endif//_CODER_H_
